package com.bobi.tfca.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.bobi.tfca.model.entity.MemberEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 会员持久层
 * @author 李文发
 * @date 2024/4/3
 */
@Mapper
public interface MemberDao extends BaseMapper<MemberEntity> {

    @Select("select `member_id`, `member_name`, `birthday`, `sex`, `telephone`, `email`, `password`, `member_status`, `role_id`  from `member`  where telephone = #{username} and password = #{password}")
    MemberEntity login(String username, String password);

    @Select("select member_id, member_name, birthday, sex, telephone, email, `password`, member_status, role_id, picture, leave_words FROM member WHERE member_status = 1 order by convert(member_name using gbk) asc")
    List<MemberEntity> listStillMembers();

}
